package com.park.eureka;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.core.env.Environment;

import java.net.InetAddress;

@SpringBootApplication
@EnableEurekaServer
@Slf4j
public class EurekaServerApplication {
    public static void main(String[] args) {
        try {
            SpringApplication app = new SpringApplication(EurekaServerApplication.class);
            Environment env = app.run(args).getEnvironment();

            log.info("=== Service Eureka === 启动成功, 当前端口 [{}], 启动环境 [{}]！！", env.getProperty("server.port")
                    ,env.getProperty("spring.profiles.active"));
            log.info("Access URLs:\n----------------------------------------------------------\n\t " +
                    "http://{}:{}/", InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")
                    + "\n----------------------------------------------------------"
            );
        } catch (Exception e) {
            log.error("starting ...", e);
        }
    }
}
